import { GCellRenderer } from "../../../../com/mui/controls/GCellRenderer";
import { ObjCreate } from "../common/ObjCreate";
import { Language } from "../../../../extend/language/Language";
import { SChaosFightPlayerInfo } from "../../../../Message/Public/SChaosFightPlayerInfo";
import { EntityUtil } from "../../scene/layer/utils/EntityUtil";
import { HTMLUtil } from "../../../../com/gengine/utils/HTMLUtil";
//class MemberRenderer
    
    export  class MemberRenderer extends GCellRenderer
    {
        constructor()
        {
            super();
            this.initUI();
            return;
        }

        /* internal  */initUI(): void
        {
            this._player = ObjCreate.createTextField("玩家名字七个字：XX分", 0, 0, 200, 20, this);
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            var loc1=undefined;
            var loc2=null;
            var loc3=null;
            var loc4=null;
            super.data = arg1;
            if (arg1.hasOwnProperty("data")) 
            {
                loc1 = arg1.data;
            }
            else 
            {
                loc1 = arg1;
            }
            if (typeof loc1 === "int") 
            {
                this._player.htmlText = Language.getString(200201);
            }
            else 
            {
                loc2 = loc1 as SChaosFightPlayerInfo;
                loc3 = "";
                loc4 = "";
                if (EntityUtil.isSameServerByRole(loc2.miniPlayer.entityId)) 
                {
                    loc4 = HTMLUtil.addColor(Language.getString(70801), "#FF00FF");
                }
                else 
                {
                    loc4 = HTMLUtil.addColor("[" + EntityUtil.getProxyName(loc2.miniPlayer.entityId) + "]", "#FF8040");
                }
                if (loc2.score >= 0) 
                {
                    loc3 = Language.getStringByParam(200206, loc2.miniPlayer.name, loc2.score);
                }
                else 
                {
                    loc3 = loc2.miniPlayer.name + "：" + Language.getString(200214);
                }
                this._player.htmlText = loc4 + " " + loc3;
            }
            return;
        }

        /* internal */ /* var */_player: Object /* flash.text.TextField */;
    }
